from selenium import webdriver
import time
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://work.weixin.qq.com/")
driver.implicitly_wait(10)

# 点击-企业登录
driver.find_element(By.CLASS_NAME, "index_top_operation_loginBtn").click()
# 等我扫码登录
# time.sleep(30)

# # 打印所有cookies
# print(driver.get_cookies())

# 通过设置cookie绕过登录
my_cookies = [{'domain': '.work.weixin.qq.com', 'expiry': 1678025827.301685, 'httpOnly': False, 'name': 'wwrtx.i18n_lan', 'path': '/', 'secure': False, 'value': 'zh'}, {'domain': '.work.weixin.qq.com', 'httpOnly': True, 'name': 'wwrtx.vst', 'path': '/', 'secure': False, 'value': 'pIeL4ZifAImYTVAqQoC0uBOxhniw0WX8vWJ61RxP4jTzJ6dKc6vlFjxmyV5xgCWwjcd5Dd9xu6Zh2iO8Bn9aOJCf1chPUK245vIrTdKTNZjTQ21A1wO0ecOXXoFqETLOe2t-mOBPrZFghSBUfVkBtLtGeoDs5kMiGQx72ywXJT_hhLM-CqamYs-0H-2RNF4ebESeCI_8nuEZLCc8h0C17_MPj-zUm_dA-eWfVyhUIE5xUnNbnvMaMsgU9wLi6_aP6Dj34eNuVrlvCg3qLW5zZA'}, {'domain': '.work.weixin.qq.com', 'expiry': 1706969814.514, 'httpOnly': False, 'name': 'wwrtx.c_gdpr', 'path': '/', 'secure': False, 'value': '0'}, {'domain': '.work.weixin.qq.com', 'httpOnly': True, 'name': 'wwrtx.ref', 'path': '/', 'secure': False, 'value': 'direct'}, {'domain': '.work.weixin.qq.com', 'httpOnly': True, 'name': 'wwrtx.refid', 'path': '/', 'secure': False, 'value': '01014239'}, {'domain': '.work.weixin.qq.com', 'httpOnly': False, 'name': 'wwrtx.vid', 'path': '/', 'secure': False, 'value': '1688858211371146'}, {'domain': '.work.weixin.qq.com', 'httpOnly': False, 'name': 'wwrtx.d2st', 'path': '/', 'secure': False, 'value': 'a3236799'}, {'domain': '.work.weixin.qq.com', 'httpOnly': True, 'name': 'wwrtx.ltype', 'path': '/', 'secure': False, 'value': '1'}, {'domain': '.work.weixin.qq.com', 'httpOnly': True, 'name': 'wwrtx.sid', 'path': '/', 'secure': False, 'value': 'lanyrmqDIWwVSFavtSOE4XsTUzw2W2yXZ2j_AsChhKtwB3xQ0p_KqZlS_plqcS69'}, {'domain': '.work.weixin.qq.com', 'httpOnly': False, 'name': 'wxpay.corpid', 'path': '/', 'secure': False, 'value': '1970325261984975'}, {'domain': '.work.weixin.qq.com', 'httpOnly': False, 'name': 'wxpay.vid', 'path': '/', 'secure': False, 'value': '1688858211371146'}, {'domain': '.work.weixin.qq.com', 'httpOnly': False, 'name': 'wwrtx.cs_ind', 'path': '/', 'secure': False, 'value': ''}, {'domain': '.work.weixin.qq.com', 'httpOnly': True, 'name': 'wwrtx.logined', 'path': '/', 'secure': False, 'value': 'true'}]
for cookie in my_cookies:
    driver.add_cookie(cookie)

driver.get("https://work.weixin.qq.com/wework_admin/frame")


time.sleep(5)
driver.quit()